package com.bjtech.web.action.management;

import com.bjtech.dao.ShareSinkResultDao;
import com.bjtech.domain.ShareSinkResult;
import com.bjtech.domain.query.ShareSinkResultQuerySpec;
import com.bjtech.web.action.LyheatBaseAction;

public class ShareSinkResultAction extends LyheatBaseAction {

	private static final long serialVersionUID = 1L;
	private ShareSinkResultDao shareSinkResultDao;
	private ShareSinkResultQuerySpec selectBean;
	
	public void prepare() throws Exception {

	}
	
	public ShareSinkResultAction() throws Exception{
		model = new ShareSinkResult();
		selectBean = new ShareSinkResultQuerySpec();
	}
	
	public void setShareSinkResultDao(ShareSinkResultDao shareSinkResultDao) {
		this.shareSinkResultDao = shareSinkResultDao;
	}

	public String execute(){
		return this.list();
	}
	
	public String list(){
		selectBean.queryParamString();
		list = this.shareSinkResultDao.selectEntityPaginatedList(new ShareSinkResult(),selectBean);
		return "list";
	}
	
	public String add(){
		return "edit";
	}
	
	public String save(){
		ShareSinkResult entity = (ShareSinkResult)model;
		if(entity.getId()==null){
			shareSinkResultDao.insertEntity(entity);
		}else{
			shareSinkResultDao.updateEntity(entity);
		}
		return "success";
	}
	
	public String edit(){
		model = this.shareSinkResultDao.selectEntity(new ShareSinkResult(),id);
		return "edit";
	}

	public String view(){
		model = this.shareSinkResultDao.selectEntity(new ShareSinkResult(),id);
		return "view";
	}
	
	public String delete(){
		model = this.shareSinkResultDao.deleteEntity(new ShareSinkResult(),id);
		return "success";
	}
	
	public ShareSinkResultQuerySpec getSelectBean() {
		return selectBean;
	}

	public void setSelectBean(ShareSinkResultQuerySpec selectBean) {
		this.selectBean = selectBean;
	}
}
